package com.zjitc.controller;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zjitc.model.Category;
import com.zjitc.model.CategorySecond;
import com.zjitc.service.CategorySecondService;
import com.zjitc.service.CategoryService;
import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;

/**
 * Create by IntelliJ IDEA
 *
 * @author: jsonor
 * @date-Time: 2018/4/25 15:55
 * @description:
 */
@Controller
@RequestMapping("/categorySecond")
public class CategorySecondController {
  @Autowired
  private CategorySecondService categorySecondService;

  @Autowired
  private CategoryService categoryService;

  @RequestMapping("/categorySecondList")
  private ModelAndView categorySecondList(@RequestParam(name = "cid") Integer cid){
    ModelAndView modelAndView=new ModelAndView();
    List<Category> categoryList=categoryService.findCategoryList();
    modelAndView.addObject("cl",categoryList);
    List<CategorySecond> cslist =categorySecondService.findCategorySecondList(cid);
    modelAndView.addObject("csl",cslist);
    modelAndView.setViewName("/user/productList.jsp");
    return modelAndView;
  }

}
